package com.audaque.encoding.controller;

import com.audaque.encoding.common.Page;
import com.audaque.encoding.common.Result;
import com.audaque.encoding.model.EncodingHistory;
import com.audaque.encoding.model.EncodingLog;
import com.audaque.encoding.service.IEncodingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Controller
@RequestMapping({"/encoding",""})
public class EncodingController {

    @Autowired
    private IEncodingService encodingService;


    @RequestMapping("/getEncodingLog")
    @ResponseBody
    public Result<List<EncodingLog>> getEncodingLog(String fileId){
        return Result.success(encodingService.selectEncodingLog(fileId));
    }

    @RequestMapping("/")
    public String encoding(){
        return "index";
    }

    @PostMapping("/page")
    @ResponseBody
    public Page<EncodingHistory> page(@RequestBody Page page){
        return encodingService.page(page);
    }

    @RequestMapping("/doEncoding")
    @ResponseBody
    public Result<Void> doEncoding(){
//        encodingService.doEncoding();
        return Result.success();
    }


}
